import type { UniverseType } from "../../sde/entity/UniverseType";

export enum PlanetResourceLevel {
  P0 = 0,
  P1 = 1,
  P2 = 2,
  P3 = 3,
  P4 = 4,
}

/**
 * 行星资源
 */
export class PlanetResource {
  /**
   * 编号
   */
  id: number;
  /**
   * 名称
   */
  name: string;
  /**
   * 行星资源所属级别
   */
  level!: PlanetResourceLevel;
  /**
   * 数量
   */
  quantity: number = 0;
  /**
   * 输入
   */
  inputs!: PlanetResource[];
  /**
   * 输出
   */
  output!: PlanetResource;
  /**
   * 所属高级资源
   */
  parent?: PlanetResource;
  /**
   * 下属低级资源
   */
  children: PlanetResource[] = [];

  constructor(type: UniverseType, quantity: number, parent?: PlanetResource) {
    this.id = type.id;
    this.name = type.name;
    // this.level = level;
    this.quantity = quantity;
    // this.inputs = inputs;
    // this.output = output;
    this.parent = parent;
    parent?.children.push(this);
  }
}
